import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CashRegisterPage extends StatefulWidget {
  @override
  _CashRegisterPageState createState() => _CashRegisterPageState();
}

class _CashRegisterPageState extends State<CashRegisterPage> with SingleTickerProviderStateMixin {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(children: [
        Container(
          padding: EdgeInsets.fromLTRB(10, 5, 0, 5),
          child: Text(
            "常用功能",
            style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold,),
          ),
          alignment: Alignment.centerLeft,
        ),
        Container(
          height: 200,
          width: double.maxFinite,
          padding: EdgeInsets.all(10),
          child: CupertinoScrollbar(
            child: GridView.builder(
              physics: BouncingScrollPhysics(),
              //设置为横向
              scrollDirection: Axis.horizontal,
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, mainAxisSpacing: 3),
              itemCount: 16,
              itemBuilder: (_, index) {
                return Container(color: Colors.blue[index % 8 * 100]);
              },
            ),
          ),
        ),
        Expanded(
          child: GridView.builder(
            physics: BouncingScrollPhysics(),
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
            itemCount: 16,
            itemBuilder: (_, index) {
              return Container(color: Colors.red[index % 8 * 100]);
            },
          ),
        ),
      ]),
    );
  }
}
